/**
 * Copyright (c) Software Institute of PKU
 * All rights reserved. 
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 */
package edu.pku.sei.modeler.editparts;

import java.beans.PropertyChangeEvent;

import org.eclipse.swt.graphics.Image;

import edu.pku.sei.modeler.edit.parts.BaseTreeEditPart;
import edu.pku.sei.modeler.icons.ModelerUIIcons;
import edu.pku.sei.modeler.model.core.CorePackage;
import edu.pku.sei.modeler.model.structure.MetaShapeElement;

/**
 * @author zl
 *
 */
public class MetaGeneraTreeEditPart extends BaseTreeEditPart {
	public MetaGeneraTreeEditPart(MetaShapeElement model) {
		super(model);
	}
	
	protected void handlePropertyChanged(PropertyChangeEvent event) {
		String propertyName = event.getPropertyName();
		if(propertyName.equals(CorePackage.GENERALIZATION_GENERAL)) {
			refreshVisuals();
		}
	}

    protected void refreshVisuals() {
    	super.refreshVisuals();
    	Image image = ModelerUIIcons.getImage(ModelerUIIcons.GENERALIZATION_ENTRY);
    	setWidgetImage(image);
        setWidgetText("generalization");
    }
}
